package com.zhl;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-10-21 16:19
 **/
public class SqlHandle {
	@Test
	public void handle()throws Exception{
		Map<String,String> map = new HashMap(34);
		map.put("TZ_VESSEL","压力容器基本信息");
		map.put("TZ_VLDECHISTORY","压力容器归属变更");
		map.put("TZ_VLCERER","压力容器变更过户报废");
		map.put("TZ_VLMLYCTION","压力容器月度运行");
		map.put("TZ_VLICTT","压力容器缺陷维修");
		map.put("TZ_VESSELINSPECTPLAN","压力容器定期检验计划管理");
		map.put("TZ_VESSELINSPECT","压力容器定期检验结论管理");
		map.put("TZ_VLALITION","压力容器年度检查报告管理");
		map.put("TZ_BOILER","锅炉基本信息");
		map.put("TZ_BRCERER","锅炉变更过户报废");
		map.put("TZ_BOILERINSPECTPLAN","锅炉定期检验计划管理");
		map.put("TZ_BOILERINSPECT","锅炉定期检验结论");
		map.put("TZ_BRALITION","锅炉年度检查报告管理");
		map.put("TZ_SPECIAL","设备基本信息管理");
		map.put("TZ_SALYITION","设备日常检查管理");
		map.put("TZ_SPECIALINSPECTPLAN","定期检验计划管理");
		map.put("TZ_SPECIALINSPECT","定期检验结论管理");
		map.put("TZ_SAFETY","安全附件基本信息");
		map.put("TZ_GAS","气瓶基本信息管理");
		map.put("TZ_GASINSPECTPLAN","气瓶定期检验计划管理");
		map.put("TZ_GASINSPECT","气瓶定期检验结论管理");
		map.put("TZ_OILVESSELINSPECT","油专容器定期检验结论管理");
		map.put("TZ_YZRQJYXM","油专容器未知");
		map.put("TZ_OSSNUPECTION","油专容器年度检查报告管理");
		map.put("TZ_HEATER","加热炉基本信息");
		map.put("TZ_HRCERER","加热炉变更过户报废");
		map.put("TZ_HEATERINSPECTPLAN","加热炉定期检验计划管理");
		map.put("TZ_HEATERINSPECT","加热炉定期检验结论管理");
		map.put("TZ_HRLALCTION","加热炉年度检查报告管理");
		map.put("TZ_BREATHER","呼吸器基本信息");
		map.put("TZ_BREATHERREPAIRINFO","呼吸器维修信息管理");
		map.put("TZ_BHEPEN","呼吸器定期检验计划管理");
		map.put("TZ_BREATHERINSPECT","呼吸器定期检验结论管理");
		map.put("TZ_ORG","1机构装置");

		File txt = new File("D:\\work\\文档\\3.塔里木\\数据库\\特种设备\\tz_1021.sql");
		BufferedReader bfr = new BufferedReader(new FileReader(txt));
		bfr.lines().forEach(line->{
			if(line.startsWith("COMMENT ON COLUMN")){
				//COMMENT ON COLUMN "SCOTT"."TZ_BHEPEN"."COL1" IS '车间';
				String[] split = line.split("\".\"");
				String tableName = split[1];
				String cname = map.get(tableName);
				if(cname.contains("基本信息")) {
					String colName = split[2].split("\" IS '")[0];
					String comment = split[2].split("\" IS '")[1].replace("';", "");
					System.out.println(cname + "\t" + tableName + "\t" + colName + "\t" + comment);
				}
			}
		});
	}
}
